<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../js/封装的函数.js"></script>

    <style>
        td {
            padding: 0 20px;
            line-height: 45px;
            border: 1px solid #333;
        }
        table{
            border-collapse: collapse;
        }
    </style>
</head>

<body>
    <p>年：<input type="text" id="year"></p>
    <p>月：<input type="text" id="month"></p>
    <p>日：<input type="text" id="day"></p>
    <p><button id="btn">判断</button></p>
    <p><input type="text" id="result" disabled></p>
    <p><input type="text" id="result1" disabled></p>
</body>
<script>
    var num = Math.round(2 + Math.random() * 98);
    if (isSu(num)) {
        document.write(num + "是素数<br>");
    } else {
        document.write(num + "不是素数<br>");
    }
    var n = 11;
    isTig1(n);
    isTig2(n);
    isDmd(n);

    // document.write("<table>");
    // document.write("<tr>");
    // document.write("<td>");
    //     document.write(isMpt());
    // document.write("</td>");
    // document.write("</tr>");
    // document.write("</table>");
    document.write(isMpt());
    console.log(isMpt());


</script>
<script>
    var yearInp = document.getElementById("year");
    var monthInp = document.getElementById("month");
    var dayInp = document.getElementById("day");
    var btn = document.getElementById("btn");
    var resultInp = document.getElementById("result");
    var result1Inp = document.getElementById("result1");

    btn.onclick = function () {
        // 3.点击取值
        var year = Number(yearInp.value), //获取年份输入框的value值
            month = Number(monthInp.value),
            day = Number(dayInp.value);
        var x = getTotalDay(year, month, day);
        if (!isYearOk(year)) {
            resultInp.value = "请输入1000-9999之间的年份";
        } else if (!isMonthOk(month)) {
            resultInp.value = "请输入1-12之间的月份";
        } else if (!isDayOk(year, month, day)) {
            resultInp.value = "请输正确的日期";
        } else {
            resultInp.value = year + "年" + month + "月" + day + "日";
            result1Inp.value = "当天是当年第" + x + "天";
        }
    }
</script>

</html>